#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, m;
	cin >> n >> m;

	double mx = INT_MIN;
	while (n--) {
		double scores = 0;
		vector<int> a(m);

		for (int i = 1; i <= m; i++)
			cin >> a[i - 1];
		sort(a.begin(), a.end());
		for (int i = 1; i < m - 1; i++) {
			scores += a[i];
		}
		scores /= m - 2;
		mx = max(mx, scores);
	}
	cout << fixed << setprecision(2) << mx;
	return 0;
}
